﻿using System;
using System.Web.UI.WebControls;
using BLL;

public partial class ViewbyProduct_Details_AllProductType : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindCustomer();
        }
    }

    protected void BindCustomer()
    {
        Customer customre = new Customer();
        GridView1.DataSource = customre.LoadEntities();
        GridView1.DataBind();
    }

    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        ProductType productType = new ProductType();
        GridView2.DataSource = productType.GetProductTypesbyCustomerID(GridView1.SelectedDataKey["CustomerID"].ToString());
        GridView2.DataBind();
        GridView2.Visible = true;
    }

    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        this.GridView1.PageIndex = e.NewPageIndex;
        BindCustomer();
    }
    protected void GridView2_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        this.GridView2.PageIndex = e.NewPageIndex;
        GridView1_SelectedIndexChanged(sender, e);
    }
}
